import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import service.AirlineReservationServiceProxy;
import constants.AirlineReservationServiceConstants;


public class EditCustomerServlet extends HttpServlet{
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
	throws ServletException, IOException {
			AirlineReservationServiceProxy proxy = new AirlineReservationServiceProxy(
					AirlineReservationServiceConstants.SERVICE_URL);
			
			String firstName = req.getParameter("firstName").toUpperCase().trim();
			String lastName =  req.getParameter("lastName").toUpperCase().trim();
			String userName  =  req.getParameter("username").trim();
			String password  =  req.getParameter("password").trim();
			String addressLine1  =  req.getParameter("addressLine1").trim();
			String addressLine2  =  req.getParameter("addressLine2");
			String city  =  req.getParameter("city").trim();
			String state  =  req.getParameter("state").trim();
			String dateOfBirth  =  req.getParameter("dob").trim();
			String nationality  =  req.getParameter("nationality").trim();
			String passportNumber  =  req.getParameter("passportNumber").trim();
			long zip = Long.parseLong(req.getParameter("zip"));
			String from = req.getParameter("from");
			System.out.println("----------------------------"+req.getParameter("from"));
			long id = Long.parseLong(req.getParameter("id"));
			
			
			proxy.editCustomer(firstName, lastName, userName, password, addressLine1, addressLine2, city, state, dateOfBirth, id, passportNumber, nationality, zip);
			
			req.setAttribute("editCustomerSucsess", "Edit Customer Success");
			req.getRequestDispatcher("listCustomer.do?from="+from).forward(req,resp);


	}
}